abstract class $RO_SET{E} < $CONTAINER{E}, $STR
****
A read-only set abstraction. No modifying operations are permitted. The abstraction consists essential kernel functions (has and elt!) and a secondary set of useful operations which are defined by RO_SET_INCL in terms of the kernel functions. A particular set implementation will normally include RO_SET_INCL and define the kernel operations as well as any of the other operations that it can perform in a more efficient manner. The conventional set operations such as union and intersection are provided for convenience, but can be easily and more flexibly achieved (with control over exactly what type of set is created) using set views:
__a_union_b_::=__#SET{E}(a.union_view(b);


Ancestors
$STR $CONTAINER{_} $ELT{_} $ELT

Descendants
FILTER_SET_VIEW{_} DIGRAPH_NODE_SET_VIEW{_,_} DIGRAPH_NODE_SET_VIEW{_} $SET{_}
SET_INCL{_} H_SET{_} SET{_} DIGRAPH_EDGE_SET_VIEW{_}
RO_SET_INCL{_} DIGRAPH_INC_SET_VIEW{_,_} DIGRAPH_OUTG_SET_VIEW{_,_} BINOP_SET_VIEW{_}



Public


Features
as_array: ARRAY{E};
**** Return the elements of the set in an array.
copy: SAME;
**** Return a copy of the current set.
diff(a: $RO_SET{E}): $RO_SET{E};
**** Return a set that is the difference of "self" and "a" i.e. contains all elements of self except those in "a"
diff_view(a: $RO_SET{E}): $RO_SET{E};
**** The resulting set behaves as the difference between self and "a". It is a view and changes as the original sets change
equals(s: $RO_SET{E}): BOOL;
**** Returns true if "s" and self contain the same elements, based on whatever element equality is used by this set.
intersection(a: $RO_SET{E}): $RO_SET{E};
**** Return a set that is the intersection of "self" and "a"
intersection_view(a: $RO_SET{E}): $RO_SET{E};
**** The resulting set behaves as the intersection between self and "a". It is a view and changes as the original sets change
is_empty: BOOL;
**** Returns 'true' if there is no element in the set.
is_subset_of(b: $RO_SET{E}): BOOL;
**** Return true if self is a subset of "b" Is defined by a.difference(b) = NULL
sym_diff(a: $RO_SET{E}): $RO_SET{E};
**** Return a set that contains all elements that are in either "self" or "a", but not in both
sym_diff_view(a: $RO_SET{E}): $RO_SET{E};
**** The resulting set behaves as the symmetric difference bet self and "a". It is a view and changes as the original sets change
union(a: $RO_SET{E}): $RO_SET{E};
**** Return a set that is the union of "self" and "a"
union_view(a: $RO_SET{E}): $RO_SET{E};
**** The resulting set behaves as the union of self and "a". It is a view and changes as the original sets change

The Sather Home Page